<!DOCTYPE html>
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <link rel="StyleSheet" type="text/css" href="/tpa/admin.css">
      <link rel="StyleSheet" type="text/css" href="/tpa/jquery-ui.css" />
      <script type="text/javascript" src="/lib/js/jquery.js"></script>
      <script type="text/javascript" src="/lib/js/jquery.ui.js"></script>
      <script type="text/javascript" src="/lib/js/meccano.js"></script>
      <script type="text/javascript" src="/lib/js/jquery.validate.js"></script>
      {%if $lang.iso neq 'en'%}
      <!-- LOCALIZATION -->
      <script type="text/javascript" src="/lib/js/localization/messages_{%$lang.iso%}.js"></script>
      {%/if%}
   </head>
   <body>
      <div class='ct' style='padding-top:50px;'>

         <table>
            <tr>
               <td align="left" valign="top" width="380">
                  <!-- USER PROFILE FORM -->

                  <form action="users.php" method="post" id="formUserProfile">
                     <table>
                        {%assign var='fields' value=$DataObject->getFields()%}
                        {%foreach from=$fields.common.fields item='field' name='i'%}
                        <tr>
                           <td class="rt"><label for="f_{%$field->alias%}" title="{%$field->alias%}">{%$field->title%}{%if $field->required%}<span class="warn">*</span>{%/if%}:</label></td>
                           <td>{%$field->getFieldHTML($DataObject)%}</td>
                        </tr>
                        {%/foreach%}
                        <tr>
                           <td></td>
                           <td><input type='submit' name='commit' id='commit' value=' {%$TR->meccano->save%} ' /></td>
                        </tr>
                     </table>
                  </form>

               </td>
               <td align="left" valign="top" width="380">
                  <!-- CHANGE USER PASSWORD FORM -->

                  <form action="users.php" method="post" id="formUserPassword">
                     <table>
                        <tr>
                           <td class="rt"><label for="f_old_pwd">{%$TR->meccano->password_old%}<span class="warn">*</span>:</label></td>
                           <td><input type="password" name="p[oldpwd]" id="f_old_pwd" /></td>
                        </tr>
                        <tr>
                           <td class='rt'><label for='f_pwd_1'>{%$TR->meccano->password%}<span class="warn">*</span>:</label></td>
                           <td><input type='password' name='p[pwd]' id='f_pwd' /></td>
                        </tr>
                        <tr>
                           <td class='rt'><label for='f_pwd_2'>{%$TR->meccano->password_repeat%}<span class="warn">*</span>:</label></td>
                           <td><input type='password' name='p[pwd_2]' id='f_pwd_2' /></td>
                        </tr>
                        <tr>
                           <td></td>
                           <td><input type='submit' name='commit' id='commit' value=' {%$TR->meccano->save%} ' /></td>
                        </tr>
                     </table>
                  </form>

               </td>
            </tr>
         </table>
      </div>

      <script type='text/javascript'>
         <!--
         $().ready(function(){
            $('#formUserProfile').validate();

            $('#formUserPassword').validate({
               rules: {
                  'p[oldpwd]': "required",
                  'p[pwd]': {required: true, minlength: 5},
                  'p[pwd_2]': {required: true, minlength: 5, equalTo: "#f_pwd"}
               },
               messages: {
                  'p[pwd_2]': { equalTo: "{%$TR->error->passw_neq|escape:'javascript'%}" }
               }
            });
         });
         //-->
      </script>
   </body>
</html>